1. Field of the Invention
This invention relates in general to database management systems performed by computers, and in particular to the selection and display of table joins in relational database management system queries.
2. Description of Related Art
Databases are computerized information storage and retrieval systems. A Relational Database Management System (RDBMS) is a database management system (DBMS) which uses relational techniques for storing and retrieving data. RDBMS software using a Structured Query Language (SQL) interface is well known in the art. The SQL interface has evolved into a standard language for RDBMS software and has been adopted as such by both the American National Standards Organization (ANSI) and the International Standards Organization (ISO).
In RDBMS software all data is externally structured into tables. The SQL interface allows users to formulate relational operations on the tables either interactively, in batch files, or embedded in host language, such as C, COBOL, etc. Operators are provided in SQL that allow the user to manipulate the data, wherein each operator operates on either one or two tables and produces a new table as a result. The power of SQL lies on its ability to link information from multiple tables or views together to perform complex sets of procedures with a single statement.
One of the most common SQL queries executed by RDBMS software is the SELECT statement. In the SQL standard, the SELECT statement generally has the format: xe2x80x9cSELECT less than clause greater than  FROM less than clause greater than  WHERE less than clause greater than  GROUP BY less than clause greater than  HAVING less than clause greater than  ORDER BY  less than clause greater than .xe2x80x9d The clauses generally must follow this sequence. Only the SELECT and FROM clauses are required and all other clauses are optional.
Generally, the result of a SELECT statement is a subset of data retrieved by the RDBMS software from one or more existing tables stored in the relational database, wherein the FROM clause identifies the name of the table or tables from which data is being selected. The subset of data is treated as a new table, termed the result table. The WHERE clause determines which rows should be returned in the result table. Generally, the WHERE clause contains a search condition that must be satisfied by each row returned in the result table. The rows that meet the search condition form an intermediate set, which is then processed further according to specifications in the SELECT clause. The search condition typically comprises one or more predicates, each of which specifies a comparison between two values from certain columns, constants or correlated values. Multiple predicates in the WHERE clause are typically connected by Boolean operators.
Another operation permitted by SQL is the JOIN operation, which concatenates horizontally all or parts of two or more tables to create a new resulting table. The JOIN operation is implied by naming more than one table in the FROM clause of a SELECT statement, although it may also be performed on the same table, as defined in the SQL standard operation named a self-join.
In order to specify a query with joins for a relational database involving more than one source table, column pairs from different tables need to be identified to describe how these tables are to be joined. It can be difficult to define the joins when the query involves a large number of columns. Therefore, it is desirable to use a graphical display tool as an interface between the user and the database, for visually indicating a join query.
There are many conventional products that assist the user in specifying valid relational joins, such as MS Access, Brio, IBM SQL Assist, etc. The effectiveness of these products decreases as number of joins, tables and columns increases. In most conventional products the users have to specify a join themselves, usually by dragging a column of one table to a column of another table. Moreover, once the represented tables are larger than the viewing area, this method becomes cumbersome.
Therefore, there is a need to provide a method and a graphical display tool as an interface between the user and the database, which can automatically specify and visually indicate all possible and valid joins, and make them available for user""s selection. This would simplify the design, development, and maintenance of applications and provide more reliable applications.
The foregoing and other objects, features, and advantages of the present invention will be apparent from the following detailed description of the preferred embodiments which makes reference to several drawing figures.
One preferred embodiment of the present invention includes a software method, useable in a computer database system with a display device, for displaying and selecting table joins. The method is capable of assisting in a user""s selection of a table join by displaying all user-selected database tables in a join overview diagram and automatically inferring and displaying in a join grid each join grid row having a potential valid table join for a pair of user-selected database tables. The method accepts the user""s selection of a join grid row from the join grid, and, in response, places a join indicator in the join overview diagram between icons representing the pair of users elected database tables from the user-selected join grid row. The user""s join grid row selection is performed with a single operation. Each row of the join grid represents a join column of a first table, a join column of a second table, and a join criteria, such as a join operator and a join type, indicating a way that the first table and the second table are to be joined by the selected join columns. The join overview diagram shows an overview of all tables selected in the query, and the joins currently available or selected for the selected database tables. The method assists the user in creating a user-defined table join by selecting elements from drop-down list boxes of an empty join grid row, and displaying the user-defined table join in the join grid and the join overview diagram.
Another preferred embodiment of the present invention is a system implementing the abovementioned method embodiment of the present invention. Yet another preferred embodiment of the present invention is a program storage device readable by a computer tangibly embodying a program of instructions executable by the computer to perform method steps of the above-mentioned method embodiment of the present invention.